namespace Sustainalytics.ClientDW.Synchronization.Tests.IntegrationTests
{
    using Sustainalytics.Synchronization.Interface;
    using System;
    using System.Collections.Concurrent;
    using System.Collections.Generic;

    public static class TestSyncContextFactoy
    {
        private const string GaMongoIp = "10.12.7.71";
        private const string DsoMongoIp = "52.208.112.211";
        private const string DatabaseGroup = "A";

        public static SyncContext Create(Action<string> log = null)
        {
            var context = new SyncContext(ErrorPolicy.BreakRightAway, log)
            {
                GAConnectionStrings = new Dictionary<string, string>(),
                DSOConnectionStrings = new Dictionary<string, string>(),
                Report = new ConcurrentBag<string>(),
                CompanyUniverses = new Dictionary<Guid, List<int>>(),
                PreviousChanges = new List<ChangedElement>()
            };
            context.GAConnectionStrings["ClientPlatform"] = String.Format("mongodb://{0}:27017/ClientPlatform", GaMongoIp);
            context.GAConnectionStrings["ClientUniverses"] = String.Format("mongodb://{0}:27017/ClientUniverses", GaMongoIp);
            context.GAConnectionStrings["RPHistoricalDataSet"] = string.Format("mongodb://{0}:27017/RPHistoricalDataSet", GaMongoIp);
            context.GAConnectionStrings["ClientDW"] = string.Format("mongodb://{0}:27017/ClientDW_{1}", GaMongoIp, DatabaseGroup);
            context.DSOConnectionStrings["ScreeningDW"] = string.Format("mongodb://{0}:27017/ScreeningDW_{1}", DsoMongoIp, DatabaseGroup);
            context.GAConnectionStrings["DWArchive"] = string.Format("mongodb://{0}:27017/DWArchive_{1}", GaMongoIp, DatabaseGroup);
            context.GAConnectionStrings["ControversyReportPDF"] = string.Format("mongodb://{0}:27017/ControversyReportPDF_{1}", GaMongoIp, DatabaseGroup);
            context.GAConnectionStrings["CompanyReportPDF"] = string.Format("mongodb://{0}:27017/CompanyReportPDF_{1}", GaMongoIp, DatabaseGroup);

            return context;
        }
    }
}
